/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SnpDbEntities;

import java.io.Serializable;

/**
 *
 * @author Łukasz 'byku' Guzik
 */
public class Category implements Serializable
{
    private static class MaxLengths
    {
	private static final int MAX_NAME_LENGTH = 100;
    }
    private int id;
    private String name;
    private int parentId;

    public int getId()
    {
	return id;
    }

    public void setId(int id)
    {
	this.id = id;
    }

    public String getName()
    {
	return name;
    }

    public void setName(String name)
    {
	if(name.length() > MaxLengths.MAX_NAME_LENGTH)
	    throw new IllegalArgumentException("Category name too long!");
	else
	    this.name = name;
    }

    public int getParentId()
    {
	return parentId;
    }

    public void setParentId(int parentId)
    {
	this.parentId = parentId;
    }

    @Override
    public String toString()
    {
	return getName();
    }
}
